import java.util.ArrayList;
import java.util.List;


public class SAAFDFFDF {

	public static void main(String[] args) throws CloneNotSupportedException {
		List<Dff> li=new ArrayList<Dff>();
		List<Dff> lit=new ArrayList<Dff>();
		Dff df1=new Dff();
		Dff tmp=null;
		for(int i=0;i<10;i++){
			tmp=new Dff();
			li=new ArrayList<Dff>();
			for(int j=0;j<10;j++){
			   li.add(new Dff());
			} 
			tmp.setLi(li);
			lit.add(tmp);
		}
		df1.setLi(lit);
		Dff df2=(Dff)df1.clone();
		List<Dff> li1=new ArrayList<Dff>();
		List<Dff> li2=new ArrayList<Dff>();
		for(Dff f:df1.getLi()){			
			for(Dff f1:f.getLi()){
			   System.out.println(f1);
			   li1.add(f);
			}   
		}
		System.out.println("**************");
		for(Dff f:df2.getLi()){
			for(Dff f1:f.getLi()){
			   System.out.println(f1);
			   li2.add(f);
			}   
		}
		for(Dff f1:li1){
			for(Dff f2:li2){
				if(f1==f2){
					System.out.println("failed");
					break;
				}
			}			
		}
		
	}

}
class Dff implements Cloneable{
	private List<Dff> li=null;
	public List<Dff> getLi() {
		return li;
	}
	public void setLi(List<Dff> li) {
		this.li = li;
	}
	protected Object clone() throws CloneNotSupportedException{
		Dff df=(Dff) super.clone();
		if(li!=null&&li.size()>0){
			List<Dff> lii=new ArrayList<Dff>();
			for(int i=0;i<this.li.size();i++){
			   lii.add((Dff)this.li.get(i).clone());								
			}
		    df.setLi(lii);
		}		
	  return df;
	}
	
}
